<script setup lang="ts">

import {inject} from "vue";

const {money, updateMoney} = inject('moneyContext', {money:0, updateMoney: (number: number)=>{}})
const car = inject('che', {brand:'默认车', price: 0})
</script>

<template>
<h3>孙组件</h3>
  <button @click="updateMoney(10)">给钱给上层组件</button>
  <h4>银子：{{money}}</h4>
  <h4>车：{{car}}</h4>

</template>

<style scoped>

</style>